Repository navigation
Add safe sequential shared-worktree reuse - #68
Merged
Merged
Conversation
Refresh the configured base for new jobs and persist saved branch ownership for resume. Gate acquisition on clean state and confirmed process ownership without resetting or copying browser state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 22c892d2-e1f2-436b-8bf5-5bbc49ddcf7d
There was a problem hiding this comment.
🟡 Changes recommended
Shared-checkout admission and recovery gaps can undermine safe branch ownership during execution.
6 open findings
Race allows branch switching after external-owner check · New Execution starts before shared branch ownership is persisted · New Stale cache context and summary used after branch acquisition · New Unconditional conflict blocks validate-only and read-only jobs · New Runtime resume flag fails to preserve workspace policy · New Shared per-bug batches combine changes on one branch · New
What changed in this PR
Adds opt-in shared-checkout reuse for sequential dashboard jobs, extending existing executor admission and session recovery with job-specific branches.
Changes:
- Refreshes the configured base and assigns separate branches for new jobs.
- Persists branch ownership for resumption and displays it in the dashboard.
- Blocks direct mutable CLI launches in shared mode and adds documentation and regression coverage.
| File | Description |
|---|---|
| test/fixlab-cli.test.js | Tests shared-mode CLI rejection. |
| test/dashboard-shared-worktree.test.js | Tests branch acquisition and preservation safeguards. |
| test/dashboard-server.test.js | Tests shared-job lifecycle and restart recovery. |
| docs/repository-onboarding.md | Documents configuration and recovery. |
| docs/architecture.md | Describes shared-checkout ownership. |
| dashboard/shared-worktree.js | Implements branch preparation, verification, and guidance. |
| dashboard/server.js | Integrates shared ownership into job orchestration. |
| dashboard/public/app.js | Displays the assigned branch. |
| bin/fixlab.js | Rejects direct mutable shared-mode execution. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+3034
to
+3035
| resourcesRunning: Boolean(frontendConnection.handle) || | ||
| frontendConnection.starting || Boolean(playwrightConnection.handle) |
| frontendConnection.starting || Boolean(playwrightConnection.handle) | ||
| }); | ||
| if (job.sharedWorkspace) { | ||
| persistDashboardState(); |
Comment on lines
+3037
to
+3039
| if (job.sharedWorkspace) { | ||
| persistDashboardState(); | ||
| const readiness = inspectRepository(resolvedRepository); |
| owner.id !== sessions.id && owner.available && owner[resource]?.running | ||
| owner.id !== sessions.id && owner.available && ( | ||
| owner[resource]?.running || | ||
| (shared && resource === "job" && (owner.frontend?.running || owner.authentication?.running)) |
Comment on lines
+111
to
+112
| if (resume) { | ||
| throw new Error("This older job has no saved shared-worktree branch. Resume it with its original workspace policy; do not guess its branch"); |
| } | ||
| return `\nShared worktree contract: | ||
| - The dashboard has exclusively acquired this checkout on branch ${workspace.branch}, based on ${workspace.remote}/${workspace.baseBranch} at ${workspace.baseCommit}. | ||
| - Work in this checkout and on this exact branch. Do not create another worktree, switch branches, reset, stash, clean, or merge/rebase the base branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
Sequential bug-fix jobs can accumulate worktree folders and dependencies, and a new fix may inherit the selected checkout's previous feature commits instead of starting from the intended PR base. Reusing a folder must preserve older jobs' branches and resumable sessions.
Change
worktreeSetup.mode: "shared"for dashboard-managed fix-and-validate jobs.Validation
npm run validatepasses: 202 unit tests and 12 browser tests; lint, type checks, formatting, documentation, governance, policy, and recovery gates passnpm pack --dry-runincludesdashboard/shared-worktree.jsThe base was fast-forwarded to merged PR #66 without source changes after validation.
Risk